# 从1加到100并输出
i = 0
su = 0
while i < 100:
    i += 1
    if i // 10 != 0 and i % 10 == 1:
        print('')
    print(i, end='\t')
    su = i + su
print('')
print(i)
print(su)

# 用while循环打印下直角三角形
# 星号一个一个打印
i = 0
while i < 6:
    i += 1
    j = 1
    while j < i:
        print('*', end='')
        j += 1
    print('')

# 星号每行相乘打印
i = 0
while i < 5:
    i += 1
    print('*' * i)

# 星号每行加一打印
i = 0
w = '*'
while i < 5:
    i += 1
    print(w)
    w += '*'
print('')

# 一个学生列表，循环打印所有学生的姓名
a = ['刘勇', '罗永欢', '杨豪']
for i in a:
    print(i)

# 用range求和
sun = 0
for i in range(100):
    sun += 1
print(sun)

t1 = {'w': 54, 'e': 57, 'r': 74, 't': 66, (2, 6): 99}
for i in t1:
    print(f'{i}：{t1[i]}')
    print("%s ：%s" % (i, t1[i]))

hobby = {'张三': ['唱跳', '打篮球'], '小杨': ['历史', '心理', '篮球']}
for i in hobby:
    print(f'{i}:  ', end='')
    for j in hobby[i]:
        print(j, end='  ')
    print()

